package model.factories.environment;

import java.util.Map;
import java.util.Scanner;
import java.util.regex.Pattern;
import model.Interpreter;
import model.SyntaxErrorException;
import model.commands.Command;
import model.commands.environment.CreateTurtleCommand;
import model.factories.CommandFactory;


/**
 * A factory that creates CreateTurtleCommand objects.
 * 
 * @author Erick Gonzalez
 */
public class CreateTurtleCommandFactory extends CommandFactory {


    private static final int NUM_ARGS = 1;
    private final Pattern myCreateTurtlePattern = Pattern.
            compile(getInterpreter().getLanguage().getString("CreateTurtlePattern"));
    

    /**
     * 
     * @param interpreter an interpreter
     */
    public CreateTurtleCommandFactory (Interpreter interpreter) {
        super(interpreter);
    }

    @Override
    public Command createCommand (Scanner commandReader,
                                  Map<String, Integer> variables) throws SyntaxErrorException {
        return createKnownArgsCommand(commandReader,
                                      new CreateTurtleCommand(),
                                      NUM_ARGS,
                                      variables);
    }

    @Override
    public Pattern patternToMatch () {
        return myCreateTurtlePattern;
    }

}
